<div class="content">
	<div class="content_i">
    <?php
		
		echo "<h2>";
			echo CHtml::image(Yii::app()->baseUrl."/assets/icon/icon-16-info.png");
			echo " Thông tin Chuyên mục";
		echo "</h2>";
		
        echo CHtml::beginForm(
			array(
				$this->controller_id."/save",
				"acategory_id"=>$row->id, 
				"parent_id" => $parent_id, 
				"page" => $page
			),
			"post",
			array("id" => "form_edit")
		);
			
		echo "<table cellpadding='3' cellspacing='0 border='0' width='50%'>";
		
			echo "<tr>";
				echo "<td class='label' width='100'>"."Chuyên mục cha"."</td>";
				echo "<td>";
				$list_parent = array();
				$list_parent[0] = "-- Parent --";
				$parent = acategory::model()->parent()->findAll();
				
				if (!is_null($parent))
				{
					foreach($parent as $p)
					{
						$list_parent[$p["id"]] = $p["name"];
					}
				}
				if ($row->id == 0)
					echo CHtml::dropDownList("parent_id", $parent_id, $list_parent);
				else
					echo CHtml::dropDownList("parent_id", $row["parent_id"], $list_parent);
				echo "</td>";
			echo "</tr>";
			
			echo "<tr>";
				echo "<td class='label' width='120'>"."Bật / Tắt"."</td>";
				echo "<td>";
					$list_enable = array(
						0 => "Tắt",
						1 => "Bật"
					);
					echo CHtml::dropDownList("enable", $row["enable"], $list_enable);
				echo "</td>";
			echo "</tr>";
			
			echo "<tr>";
				echo "<td class='label' width='120'>"."Tên chuyên mục"."</td>";
				echo "<td>";
				echo CHtml::textField("name", $row["name"], array('style'=>'width:300px'));
				echo "</td>";
			echo "</tr>";
			
			echo "<tr>";
				echo "<td class='label' width='120'>"."Alias"."</td>";
				echo "<td>";
				echo CHtml::textField("alias", $row["alias"], array('style'=>'width:300px'));
				echo "</td>";
			echo "</tr>";
			
			echo "<tr>";
				echo "<td class='label' width='120'>"."Thứ tự"."</td>";
				echo "<td>";
				echo CHtml::textField("order", $row["order"], array('style'=>'width:300px'));
				echo "</td>";
			echo "</tr>";
			
			echo "<tr>";
				echo "<td>"."</td>";
				echo "<td>";
					echo "<div class='space_5'></div>";

					echo 
						"<div class='button' id='button_submit'>" .
							"<div style='float:left; width:20px;'>" .
								CHtml::image(Yii::app()->baseUrl."/assets/icon/icon-16-save.png") .
							"</div>" .
							"<div style='float:left; min-width:40px;font-weight:bold'>".
								"Save" .
							"</div>" .
						"</div>";
					
					echo 
						"<div class='button' id='button_cancel'>" .
							"<div style='float:left; width:20px;'>" .
								CHtml::image(Yii::app()->baseUrl."/assets/icon/icon-16-check.png") .
							"</div>" .
							"<div style='float:left; min-width:50px;font-weight:bold'>".
								"Cancel" .
							"</div>" .
						"</div>";
						
				echo "</td>";
			echo "</tr>";
				
		echo "</table>";
		echo CHtml::endForm();
	?>
    </div>
</div><!-- end div right -->

<script language="javascript">
$(document).ready(function(){

	$('#button_submit').click(function(){
		$('#form_edit').submit();
	});
	
	$('#button_cancel').click(function(){
		window.location = '<?php
			$url = Yii::app()->createUrl(
				$this->route . "/view",
				array("parent_id"=>$parent_id, "page" => $page)
			);
			echo $url;
		?>';
	});
});
</script>